// 导入请求对象
import request from '../utils/request'

// 封装请求方法-频道请求
const getChannels = () => {
  return request({
    method: 'get',
    url: '/v1_0/user/channels'
  })
}

// 封装数据请求-列表数据
/* eslint-disable */
const getArticles = ({ timestamp, channel_id }) => {
  return request({
    url: '/v1_0/articles',
    method: 'get',
    params: {
      with_top: 1, // 获取置顶文章
      timestamp, // 获取分页数据的时间戳
      channel_id // 频道的id
    }
  })
}

// 封装数据请求-不感兴趣请求
const disLikeArticle = ({ target }) => {
  return request({
    method: 'post',
    url: '/v1_0/article/dislikes',
    data: {
      target
    }
  })
}

// 封装数据请求-举报
const reportArticle = ({ target, type }) => {
  return request({
    method: 'post',
    url: '/v1_0/article/reports',
    data: {
      target,
      type
    }
  })
}
/* eslint-disable */

// 暴露接口
export { getChannels, getArticles, disLikeArticle, reportArticle }
